<?php
namespace App\Services\config;
use App\Dao\config\UploadDao;
use App\Models\config\ConfigModel;
use App\Services\BaseServices;
use App\Dao\config\OrmDao;
use App\Exceptions\ApiException as HOException;
use Hlcreation\Basic\Helper;
use Illuminate\Support\Facades\DB;

class OrmServices extends BaseServices
{

    protected $dao;

    public function __construct(OrmDao $dao)
    {
        $this->dao = $dao;
    }


    public function OrmSave($arr){
        return $this->dao->ormSaves($arr);
    }




    //配置详情
    public function OrmInfo($uid,$type){
        return $this->dao->ormInfos($uid,$type);
    }



    public function configInfos($uid){
        return $this->dao->configInfo($uid);
    }



    public function configOpen($uid,$type,$status){

        $place = ConfigModel::where('type',$type)->where('creator_uid',$uid)->update(['status'=>$status]);
                        ConfigModel::where('type',$type)->where('creator_uid',$uid)->where('menu_name','status')->update(['value'=>$status]);


        if ($type == 1){
            ConfigModel::where('type',1)->where('creator_uid',$uid)->update(['status'=>$status]);
            ConfigModel::where('type',1)->where('creator_uid',$uid)->where('menu_name','status')->update(['value'=>$status]);
            ConfigModel::where('type',2)->where('creator_uid',$uid)->update(['status'=>$status]);
            ConfigModel::where('type',2)->where('creator_uid',$uid)->where('menu_name','status')->update(['value'=>$status]);
            ConfigModel::where('type',3)->where('creator_uid',$uid)->update(['status'=>$status]);
            ConfigModel::where('type',3)->where('creator_uid',$uid)->where('menu_name','status')->update(['value'=>$status]);
        }

        return $place;

    }




}
